// 例子32

{
    // 浅拷贝
    const target = {};
    const source = {
        a: {
            b: 1
        },
        c: 'c'
    }
    Object.assign(target, source);
    source.c = 'x';
    source.a.b = 2;
    console.log(target); // {a: {b: 2}, c: 'c'}
}

console.log('----------------------------------');

{
    // 数组的处理
    console.log(Object.assign([1, 2, 3], [4, 5])); // [4, 5, 3]
}

console.log('----------------------------------');

{
    // 取值函数的处理
    const source = {
        get foo() {
            return 1;
        }
    }
    const target = {};
    console.log(Object.assign(target, source)); // {foo: 1}
}